﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

namespace CustomsDocumentOA.Project.Migrations
{
    public partial class Firstcommit : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.CreateTable(
                name: "CDOA_Customer",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    cCustomerName = table.Column<string>(maxLength: 100, nullable: false),
                    cAddress = table.Column<string>(maxLength: 200, nullable: false),
                    cBoss = table.Column<string>(maxLength: 20, nullable: true),
                    cCode = table.Column<string>(maxLength: 36, nullable: true),
                    cEstablishTime = table.Column<DateTime>(nullable: true),
                    cDescribe = table.Column<string>(maxLength: 1000, nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CDOA_Customer", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CDOA_CustomerDetail",
                columns: table => new
                {
                    Id = table.Column<long>(nullable: false)
                        .Annotation("SqlServer:Identity", "1, 1"),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    CreatorUserId = table.Column<long>(nullable: true),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    cCustomerID = table.Column<int>(nullable: false),
                    cTitle = table.Column<string>(maxLength: 100, nullable: true),
                    cContent = table.Column<string>(maxLength: 500, nullable: true),
                    cFileAddress = table.Column<string>(maxLength: 200, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CDOA_CustomerDetail", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CDOA_Visit_Record",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    WorkOrderNo = table.Column<string>(nullable: true),
                    RecordId = table.Column<Guid>(nullable: false),
                    WorkOrderName = table.Column<string>(nullable: true),
                    UserId = table.Column<int>(nullable: false),
                    UserName = table.Column<string>(nullable: true),
                    CustomerId = table.Column<int>(nullable: false),
                    CustomerName = table.Column<string>(nullable: true),
                    DealTime = table.Column<DateTime>(nullable: false),
                    CreatTime = table.Column<DateTime>(nullable: false),
                    UpdateTime = table.Column<DateTime>(nullable: false),
                    IsDelete = table.Column<int>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CDOA_Visit_Record", x => x.Id);
                });

            migrationBuilder.CreateTable(
                name: "CDOA_WorkOrder",
                columns: table => new
                {
                    Id = table.Column<Guid>(nullable: false),
                    LastModifierUserId = table.Column<long>(nullable: true),
                    LastModificationTime = table.Column<DateTime>(nullable: true),
                    CreatorUserId = table.Column<long>(nullable: true),
                    CreationTime = table.Column<DateTime>(nullable: false),
                    ExpectedTime = table.Column<DateTime>(nullable: false),
                    EndTime = table.Column<DateTime>(nullable: false),
                    WorkOrderNo = table.Column<string>(nullable: true),
                    Title = table.Column<string>(maxLength: 200, nullable: true),
                    Memo = table.Column<string>(maxLength: 500, nullable: true),
                    Assignment = table.Column<string>(maxLength: 50, nullable: true),
                    CustomName = table.Column<string>(maxLength: 50, nullable: true),
                    BusinessManager = table.Column<string>(maxLength: 50, nullable: true),
                    IsCancel = table.Column<bool>(nullable: false),
                    Status = table.Column<int>(nullable: false),
                    Contact = table.Column<string>(maxLength: 50, nullable: true)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CDOA_WorkOrder", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CDOA_Customer");

            migrationBuilder.DropTable(
                name: "CDOA_CustomerDetail");

            migrationBuilder.DropTable(
                name: "CDOA_Visit_Record");

            migrationBuilder.DropTable(
                name: "CDOA_WorkOrder");
        }
    }
}
